import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn } from 'typeorm';
import { IsNotEmpty } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

@Entity()
export class Zhima {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ comment: '芝麻账户' })
  @ApiProperty({ description: '芝麻账户', example: '账户1' })
  @IsNotEmpty({ message: '芝麻账户不能为空' })
  name: string;

  @Column({ comment: 'key' })
  @ApiProperty({ description: 'key', example: '1111' })
  @IsNotEmpty({ message: 'key不能为空' })
  key: string;

  @Column({ comment: 'secret' })
  @ApiProperty({ description: 'secret', example: '1111' })
  @IsNotEmpty({ message: 'secret不能为空' })
  secret: string;

  // 账户余额(USDT)
  @Column({ comment: '账户余额(USDT)', default: '-' })
  @ApiProperty({ description: '账户余额(USDT)', example: '1111' })
  balance: string;

  @Column({ comment: '是否激活', default: true })
  is_active: boolean;

  @CreateDateColumn({
    type: 'timestamp',
    nullable: false,
    name: 'create_time',
    comment: '创建时间',
  })
  create_time: Date;

  @UpdateDateColumn({
    type: 'timestamp',
    nullable: false,
    name: 'update_time',
    comment: '更新时间',
  })
  update_time: string;
}
